
 /**
 * RegistAction.java.java.
 * User: BrianChen Date: 2012-6-5 下午10:01:49
 *
 * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
 * All rights reserved.
 */
package com.collapsar.snail.user.action;

import com.collapsar.core.action.BaseStrutsAction;
import com.collapsar.core.security.model.User;
import com.collapsar.core.security.service.IUserManager;

/**
 * <pre>
 * REVISIONS: 
 * Version 	Date 		Author 			Description
 * ------------------------------------------------------------------- 
 * 1.0 		2012-6-5 	BrianChen 	1. Created this class. 
 * </pre>
 * 
 * @author BrianChen
 * @date 2012-6-5 下午10:01:49
 * @version 1.0
 * @see
 * 
 */
@SuppressWarnings("serial")
public class RegistAction extends BaseStrutsAction{
	private IUserManager userManager = null;
	private User user = null;
	
	
	
	@Override
	public String execute() throws Exception {
		boolean success = this.userManager.regist(this.user);
		if(success){
			return "user_login";
		}else{
			String msg = this.userManager.getMessage();
			if(IUserManager.R_USER_EXIST.equals(msg)){
				this.addFieldError("user.account", "该用户已经存在~！");
				return "user_regist";	
			}else{
				return null;
			}
		}
		
	}

	
	
	


	public IUserManager getUserManager() {
		return userManager;
	}

	public void setUserManager(IUserManager userManager) {
		this.userManager = userManager;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}

